﻿#region Header

/*
Remote views based on linq
By

Pascal Hauser 
Dipl. Ing. in Informatik, Hochschule für Technik Rapperswil, 2006
Master Thesis, Hochschule für Technik Rapperswil, 2008-2010

and

Raphael Gfeller
Dipl. Ing. in Informatik, Hochschule für Technik Rapperswil, 2006
Master Thesis, Hochschule für Technik Rapperswil, 2008-2010

*/

#endregion

#region Usings

using System;
using System.ComponentModel;

#endregion

namespace InterLinq.Test {
	/// <summary>
	/// Description of the class
	/// </summary>
	[Serializable]
	public class WPFProduct : INotifyPropertyChanged, IProduct {
		#region Public Properties

		/// <summary>
		/// Get or sets the id
		/// </summary>
		public virtual Guid Id { get; set; }

		/// <summary>
		/// Returns the name of the product
		/// </summary>
		public virtual string Name {
			get { return m_name; }
			set {
				m_name = value;
				if (PropertyChanged != null) {
					PropertyChanged(this, new PropertyChangedEventArgs("Name"));
				}
				if (NameChanged != null) {
					NameChanged(this, EventArgs.Empty);
				}
			}
		}

		/// <summary>
		/// Returns the price of the product in sfr
		/// </summary>
		public virtual decimal Price {
			get { return m_price; }
			private set {
				m_price = value;
				if (PropertyChanged != null) {
					PropertyChanged(this, new PropertyChangedEventArgs("Price"));
				}
			}
		}

		#endregion

		#region Public Methods

		/// <summary>
		/// Ctr
		/// </summary>
		/// <param name="name">name of the product</param>
		/// <param name="price">price of the product [sfr]</param>
		public WPFProduct(string name, decimal price) {
			Name = name;
			Price = price;
		}

		/// <summary>
		/// Ctr
		/// </summary>
		public WPFProduct() {
		}

		#endregion

		#region Public Fields

		public virtual event EventHandler NameChanged;

		#endregion

		#region Private Fields

		private string m_name;
		private decimal m_price;

		#endregion

		#region INotifyPropertyChanged Members

		public virtual event PropertyChangedEventHandler PropertyChanged;

		#endregion
	}
}